package com.ruoyi.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson2.JSON;
import com.ruoyi.framework.websocket.WebSocketUsers;
import com.ruoyi.system.domain.AcWorkOrder;
import com.ruoyi.system.mapper.AcWorkOrderMapper;
import com.ruoyi.system.service.IAcWorkOrderService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.AcPayfeesInfo;
import com.ruoyi.business.service.IAcPayfeesInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 租金缴费统计Controller
 *
 * @author ruoyi
 * @date 2025-02-20
 */
@RestController
@RequestMapping("/business/payfeesInfo")
public class AcPayfeesInfoController extends BaseController
{
    @Autowired
    private IAcPayfeesInfoService acPayfeesInfoService;
    @Autowired
    private IAcWorkOrderService acWorkOrderService;
    @Autowired
    private AcWorkOrderMapper acWorkOrderMapper;

    /**
     * 查询租金缴费统计列表
     */
    @PreAuthorize("@ss.hasPermi('business:payfeesInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(AcPayfeesInfo acPayfeesInfo)
    {
        startPage();
        List<AcPayfeesInfo> list = acPayfeesInfoService.selectAcPayfeesInfoList(acPayfeesInfo);
        return getDataTable(list);
    }

    @GetMapping("/seasonList")
    public TableDataInfo seasonList(AcPayfeesInfo acPayfeesInfo)
    {
        startPage();
        List<AcPayfeesInfo> list = acPayfeesInfoService.selectAcPayfeesInfoSeasonList(acPayfeesInfo);
        return getDataTable(list);
    }

    @GetMapping("/monthList")
    public TableDataInfo monthList(AcPayfeesInfo acPayfeesInfo)
    {
        startPage();
        List<AcPayfeesInfo> list = acPayfeesInfoService.selectAcPayfeesInfoMonthList(acPayfeesInfo);
        return getDataTable(list);
    }

    /**
     * 导出租金缴费统计列表
     */
    @PreAuthorize("@ss.hasPermi('business:payfeesInfo:export')")
    @Log(title = "租金缴费统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AcPayfeesInfo acPayfeesInfo)
    {
        List<AcPayfeesInfo> list = acPayfeesInfoService.selectAcPayfeesInfoList(acPayfeesInfo);
        ExcelUtil<AcPayfeesInfo> util = new ExcelUtil<AcPayfeesInfo>(AcPayfeesInfo.class);
        util.exportExcel(response, list, "租金缴费统计数据");
    }

    /**
     * 获取租金缴费统计详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:payfeesInfo:query')")
    @GetMapping(value = "/{payfId}")
    public AjaxResult getInfo(@PathVariable("payfId") Long payfId)
    {
        return success(acPayfeesInfoService.selectAcPayfeesInfoByPayfId(payfId));
    }

    /**
     * 新增租金缴费统计
     */
    @PreAuthorize("@ss.hasPermi('business:payfeesInfo:add')")
    @Log(title = "租金缴费统计", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AcPayfeesInfo acPayfeesInfo)
    {
        return toAjax(acPayfeesInfoService.insertAcPayfeesInfo(acPayfeesInfo));
    }

    /**
     * 修改租金缴费统计
     */
    @PreAuthorize("@ss.hasPermi('business:payfeesInfo:edit')")
    @Log(title = "租金缴费统计", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AcPayfeesInfo acPayfeesInfo)
    {
        return toAjax(acPayfeesInfoService.updateAcPayfeesInfo(acPayfeesInfo));
    }

    /**
     * 删除租金缴费统计
     */
    @PreAuthorize("@ss.hasPermi('business:payfeesInfo:remove')")
    @Log(title = "租金缴费统计", businessType = BusinessType.DELETE)
	@DeleteMapping("/{payfIds}")
    public AjaxResult remove(@PathVariable Long[] payfIds)
    {
        return toAjax(acPayfeesInfoService.deleteAcPayfeesInfoByPayfIds(payfIds));
    }


}
